package com.time.auth.common.enums;

import lombok.Getter;

/**
 * 用户类型枚举类
 *
 * @author: HuangQi
 * @date: Created in 9:35 2025/9/30
 * @description: 用户类型枚举类
 */
@Getter
public enum AuthUserTypeEnum {

    ADMIN(1, "admin"),
    USER(2, "user");

    private Integer code;
    private String desc;

    AuthUserTypeEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static AuthUserTypeEnum getByCode(Integer codeVal) {
        for (AuthUserTypeEnum authUserTypeEnum : AuthUserTypeEnum.values()) {
            if (authUserTypeEnum.code.equals(codeVal)) {
                return authUserTypeEnum;
            }
        }
        return null;
    }
}
